/**
 * 
 */
package niuke.huawei;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class 整型字符串排序 {

	static class Item implements Comparable<Item> {
		String string;
		int index;
		int comInt;

		public Item(String string, int index) {
			this.string = string;
			this.comInt = string.length() < 3 ? Integer.parseInt(string)
					: Integer.parseInt(string.substring(string.length() - 3));
		}

		@Override
		public int compareTo(Item o) {
			if (comInt != o.comInt) {
				return comInt - o.comInt;
			}
			return this.index - o.index;
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String string = scanner.nextLine();
		int k = scanner.nextInt();
		String[] strings = string.split(" ");
		Item[] items = new Item[strings.length];
		for (int i = 0; i < strings.length; i++) {
			items[i] = new Item(strings[i], i);
		}
		Arrays.sort(items);
		System.out.println(items[k - 1].string);
	}
}
